package com.goods.shop.exam;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class E002 {
    public static void main(String[] args) {
        E002 service=new E002();
        Scanner scanner=new Scanner(System.in);
        String line=scanner.nextLine();
        String word=line;
        Pattern pattern=Pattern.compile("[^a-zA-Z]{1,}"+word+"[^a-zA-Z]{1,}");
        int count=0;//次数
        while(!(line=scanner.nextLine()).equals("-1")){
            Matcher matcher=pattern.matcher(line);
            while(matcher.find()){
                count++;
            }
//            line=scanner.nextLine();
        }

        System.out.print(count);

    }
}
